<?php

if (!defined('BASE_PATH'))
    exit('No direct script access allowed');

/**
 * Description of email_post_user
 *
 * @author xiaof-pc
 */
class email_post_user_model extends Model {

    /**
     * 根据ID查询
     * @param type $id
     * @return rows
     */
    function get_email_post_user_by_id($id) {
        $sql = $this->db->get_where('wd_email_post_user', array('email_post_user_id' => intval($id)));
        return $sql->row_array();
    }

    /**
     * 根据条件查取
     * @param type $pid
     * @return rows
     */
    function get_email_post_user_list($where, $order = 'desc', $nums = 16, $offset = 0, $by = 'email_post_user_id') {
        $this->db->from('wd_email_post_user');
        $this->db->where($where);
        $this->db->order_by($by, $order);
        $this->db->limit($nums, $offset);
        $sql = $this->db->get();
        return $sql->result_array();
    }

    /**
     * 统计条数
     * @param type $where
     * @return num
     */
    function get_email_post_user_nums($where = array()) {
        $this->db->from("wd_email_post_user");
        if (count($where) >= 1) {
            $this->db->where($where);
        }
        return $this->db->count_all_results();
    }

    /**
     * 添加
     * @param type $data
     * @return boolean
     */
    function insert_email_post_user($data) {
        return $this->db->insert('wd_email_post_user', $data);
    }

    /**
     * 修改
     * @param $id
     * @param $data
     * @return boolean
     */
    function updata_email_post_user_by_id($id, $data) {
        return $this->db->update('wd_email_post_user', $data, "email_post_user_id = " . intval($id) . "");
    }

    /**
     * 删除
     * @param $id
     * @return boolean
     */
    function delete_email_post_user_by_id($id) {
        return $this->db->delete('wd_email_post_user', array('email_post_user_id' => intval($id)));
    }
}

/* End of file email_post_user.php */
/* Location: ./application/models/email_post_user.php */
?>